
import { registerClass } from "../../../cfw/tools/class_decorator";
import BaseAd from "../../core/base/BaseAd";
/**
 * https://open.oppomobile.com/wiki/doc#id=10538
 */
@registerClass('OppoInsertAd')
export default class OppoInsertAd extends BaseAd {
    hide(): void {
        throw new Error("Method not implemented.");
    }

    load(): void {
        if (this.ad) {
            this.ad.load();
        }
    }
    show(): void {
        if (this.ad) {
            this.ad.show();
        }
    }
    create() {
        console.log(' show insert ad ')
        if (!this.ad) {
            this.ad = this.sdk.createInsertAd({
                adUnitId: this.adUnitID
            });
            this.ad.onLoad(this.getFunc(this.onLoad))
            this.ad.onError(this.getFunc(this.onError))
        }
    }

    destroy(): void {
        if (this.ad) {
            this.ad.offLoad(this.getFunc(this.onLoad))
            this.ad.offError(this.getFunc(this.onError))
            this.ad.destroy()
            this.ad = null;
        }
    }



}
